﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Runtime.InteropServices;
using System.Reflection;

using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swcommands;
using SolidWorks.Interop.swconst;
using SolidWorks.Interop.swpublished;

using SwAddinHelpers.Contracts;
using SwAddinHelpers.TaskPane;
using SwAddinHelpers.PropertyManager;
using SwAddinHelpers.Sinks;
using SwAddinHelpers.CommandManager;
using SwAddinHelpers.MenuManager;

namespace SwAddinHelpers.Base
{
    [ComVisible(true)]
    public class TaskPaneControlBase: UserControlBase
    {
        public override UserControlHostBase SetOwner
        {
            set
            {
                base.SetOwner = value;

                ((TaskPaneHost)_OwnerHost).TaskPaneActivate += new EventHandler(OnTaskPaneActivate);
                ((TaskPaneHost)_OwnerHost).TaskPaneDeactivate += new EventHandler(OnTaskPaneDeactivate);
                ((TaskPaneHost)_OwnerHost).TaskPaneDestroy += new EventHandler(OnTaskPaneDestroy);
            }
        }

        public override void Untie()
        {
            ((TaskPaneHost)_OwnerHost).TaskPaneActivate -= new EventHandler(OnTaskPaneActivate);
            ((TaskPaneHost)_OwnerHost).TaskPaneDeactivate -= new EventHandler(OnTaskPaneDeactivate);
            ((TaskPaneHost)_OwnerHost).TaskPaneDestroy -= new EventHandler(OnTaskPaneDestroy);
        }

        public virtual void OnTaskPaneDestroy(object sender, EventArgs e)
        {
            
        }

        public virtual void OnTaskPaneDeactivate(object sender, EventArgs e)
        {
            
        }

        public virtual void OnTaskPaneActivate(object sender, EventArgs e)
        {
            
        }
    }
}
